package com.webemail.sys.service.impl;



import java.util.List;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.webemail.sys.mapper.SysUserMapper;
import com.webemail.sys.model.SysUser;
import com.webemail.sys.service.UserService;

/**
 * 用户管理
 *
 * @author LaiHQ*/
@Service
public class UserServiceImpl implements UserService{
	private Logger logger = LoggerFactory.getLogger(getClass());

	@Resource
	public SysUserMapper sysUserMapper;

	
	/**
	 * 用户保存
	 * */
	@Override
	public String saveUserInfo(SysUser sysUser) {
		
		logger.info("saveUserInfo=="+sysUser.getPassword());

		int i=sysUserMapper.insert(sysUser);
		return ""+i;
	}

	/**
	 * 根据id 删除用户
	 * */
	@Override
	public String deleteUserById(String id) {
		int i=sysUserMapper.deleteById(Long.parseLong(id));
		return ""+i;
	}

	/**
	 * 查询用户列表
	 * */
	@Override
	public List<SysUser> listUserInfo(String org) {

		return sysUserMapper.selectList(Wrappers.lambdaQuery(SysUser.class).like(SysUser::getOrgname,org));
	}

	@Override
	public SysUser userInfoById(String id) {
		// TODO Auto-generated method stub
		return sysUserMapper.selectById(id);
	}

	
	
	
}
